import { omitIndex, type TineConfigure } from '@tencent/rollup-config-tine'
export default {
    libType: 'pattern',
    entry: {
        filename: '[dir]',
        ignore: ['./src/core/**', '**/node_modules/**'],
        pattern: './src/**/index.ts'
    },
    output: {
        exports: 'named',
        dir: 'dist',
        format: 'esm',
        entryFileNames: omitIndex('[name]/index.js'),
        chunkFileNames: 'common/[name].js',
        globals: {
            Taro: 'Taro',
            wx: 'wx'
        }
    },
    external: [/^@tencent\/kite/, /^@tarojs\/\w+$/],
    build: {
        babelType: 'h5-lib',
        target: process.env.NODE_ENV === 'production' ? 'es5' : 'es6',
        isMinify: process.env.NODE_ENV === 'production' ? true : false
    },
    declaration: {
        declarationDir: '',
        output: {
            dir: './dist',
            entryFileNames: omitIndex('[name]/index.d.ts'),
            chunkFileNames: 'common/[name].ts'
        }
    }
} satisfies TineConfigure
